home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 3
/
Info_Mac_1994-01.iso
/
Development
/
4th Dimension
/
Credit Card Check Source
< prev
next >
Wrap
Internet Message Format
|
1993-12-20
|
1KB
From: "Rene G.A. Ros" <rgaros@bio.vu.nl>
Subject: creditcard-check.txt
Date: Fri, 13 Aug 93 12:33:10 MET DST
Card check proc.txt
Small procedure to check if credit card number is correctly
entered.
`this procedure calculates the last number of a credit card number
`(at least VISA and Mastercard). These have a kind checksum.
`By doing this and comparing with the entered value you can check if
`there were no type mismatches.
`Based on some C-source code by Diomidis Spinellis <dds@doc.ic.ac.uk>
`published on Internet.
`Ported to 4D by Rene G.A. Ros
`D.C. van Krimpenstraat 3
`1067 SG Amsterdam
`The Netherlands, Europe
`rgaros@bio.vu.nl
`digit:=Card check(creditcard nr)
`digit is a single character which is calculated
`creditcard nr are the first 15 characters of the credit card nr
`place somewhere else:
`C_STRING("Card check";15;$1)
`C_STRING("Card check";1;$0)
C_INTEGER($length;$i;$s;$t)
$length:=Length($1)
For ($i;0;$length-1)
$t:=Num($1$length-$i)*(1+(($i+1)%2))
$s:=$s+$t-(9*Num($t>=10))
End for
$0:=((10-$s%10)%10)